from env.env_cmd import EnvCmd
from env.env_def import RED_AIRPORT_ID, BLUE_AIRPORT_ID, UnitType

class CommandDefault(object):
    TAKEOFF_PATROL_POINT = [130000, 0, 8000]#起飞点位 [x y z]
    TAKEOFF_PATROL_PARAMS = [270, 20000, 20000, 1000, 7200]  # 起飞参数 最后为巡逻速度和时间
    # TAKEOFF_PATROL_PARAMS = [270, 20000, 20000, 250, 7200]#起飞参数 最后为巡逻速度和时间
    '''
    巡逻速度（浮点型，单位：米/秒,歼击机参考速度250m/s,预警机/干扰机/轰炸机参考速度166m/s,无人机参考速度90m/s）
    '''

    A2A_PATROL_HEIGHT = 8000
    A2A_PATROL_PARAMS = [270, 20000, 20000, 300, 7200]

    AWACS_PATROL_PARAMS = [270, 20000, 20000, 225, 7200, 2]


class Command(object):

    @staticmethod
    def a2a_attack(self_id, target_id):
        return EnvCmd.make_airattack(self_id, target_id, 1)

    @staticmethod
    def area_patrol(self_id, patrol_points,
                    patrol_params=CommandDefault.A2A_PATROL_PARAMS):
        return EnvCmd.make_areapatrol(self_id, *patrol_points, *patrol_params)

    @staticmethod
    def awacs_areapatrol(self_id, patrol_points,
                         awacs_params=CommandDefault.AWACS_PATROL_PARAMS):
        return EnvCmd.make_awcs_areapatrol(
            self_id, *patrol_points, *awacs_params)

    @staticmethod
    def takeoff_areapatrol(airport_id, fly_num, fly_type,
                           patrol_points=CommandDefault.TAKEOFF_PATROL_POINT,
                           patrol_params=CommandDefault.TAKEOFF_PATROL_PARAMS):
        return EnvCmd.make_takeoff_areapatrol(
            airport_id, fly_num, fly_type, *patrol_points, *patrol_params)
